import request from "@/utils/request";
/**
 * 获取权限列表
 * @returns Promise
 */
export const getPermListAPI = () => {
  return request({
    method: "get",
    url: "/sys/permission",
  });
};

/**
 * 新增权限
 * @param {Object} permFrom 权限表单
 * @returns promise
 */
export const addPermAPI = (permFrom) => {
  return request({
    method: "post",
    url: "/sys/permission",
    data: permFrom,
  });
};

/**
 * //获取权限详情
 * @param {String} id  权限id
 * @returns promise
 */
export const getPermDetailAPI = (id) => {
  return request({
    method: "get",
    url: `/sys/permission/${id}`,
  });
};
/**
 *编辑权限
 * @param {Object} permFrom 权限表单
 * @returns promise
 */
export const editPermAPI = (permFrom) => {
  return request({
    method: "put",
    url: `/sys/permission/${permFrom.id}`,
    data: permFrom,
  });
};

/**
 *删除权限
 * @param {String} id 删除权限id
 * @returns promise
 */
export const delPermAPI = (id) => {
  return request({
    method: "delete",
    url: `/sys/permission/${id}`,
  });
};
